<!DOCTYPE html>
<html>

<head>
	<title>{$title}</title>
    <meta charset="utf-8">
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="initial-scale=1, width=device-width, maximum-scale=1, user-scalable=no">
	<meta name="viewport" content="initial-scale=1.0,user-scalable=no,maximum-scale=1" media="(device-height: 568px)">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-touch-fullscreen" content="yes">
	<meta name="full-screen" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="format-detection" content="telephone=no">
	<meta name="format-detection" content="address=no">
	
	<!-- import CSS -->
	<link rel="stylesheet" href="{$Think.config.site.resource_url}css/assets/style.css?11">
	<script src="{$Think.config.site.resource_url}js/assets/jquery.js"></script>
	
	<script>
		$(function(){
			$('.screen_a').click(function(){
				$('#screen').show();
				$('#screen_bg').show();
				$('html,body').addClass('ovfHiden'); //使网页不可滚动
			})
			$('.cancel').click(function(){
				$('#screen').hide();
				$('#screen_bg').hide();
				$('html,body').removeClass('ovfHiden'); //使网页恢复可滚
			})
		})
	</script>

</head>

<body>	
	
<!--筛选弹窗-->
<div class="screen" id="screen">
	<div class="screen_main">
		<form action="/home/Seller/index" id="form" method="get">
			<div class="binding_tit">商户名称：</div>
			<div class="binding_select"><input value=""  placeholder="请输入商户名称" name="name"></div>
			<div class="binding_tit">归属地推：</div>
			<div class="binding_select">
				<select name="salesman">
					<option value="">请选择归属地推</option>
					{volist name="agents" id="v"}
					<option value="{$v.id}">{$v.real_name}</option>
					{/volist}
				</select>
			</div>
			<div class="binding_btn">
				<button class="state_confirm">确认</button>
				<button class="cancel">取消</button>
			</div>
		</form>
    </div>
</div>
<div id="screen_bg"></div>
	
<!-- 顶部 -->
<div class="head">
	<div class="head_back"><a href="/home/Index/index"><img src="{$Think.config.site.resource_url}images/assets/arrow.png"></a></div>
    <div class="head_txt">商户管理</div>
</div>

<div class="flow_btn">
	<a href="/home/Seller/add" class="flow_a" style="width:35%;"><img src="{$Think.config.site.resource_url}images/assets/add.png">添加商户</a>
	<a href="javascript:;" class="flow_a flow_btn3 fr screen_a">筛选</a>
</div>

<div class="store_main">
    {notempty name="sellers"}
	<ul  class="showMoreNChildren" pagesize="10">
		{volist name="sellers" id="v"}
		<li>
			<div class="store_head">
				<div class="store_h_left">商户名称：{$v.name}</div>
				<a href="/home/Seller/putPage?id={$v.id}">修改</a>
			</div>
			<div class="store_con">
				<span class="store_sp_left">电话：{$v.phone}</span>
				<span class="store_sp_right">所属地推：{$v.real_name}</span>
			</div>
			<div class="flow_sp mt1">
				<span class="flow_sp2">{$v.per_price}元/小时</span>
				<span class="flow_sp3">{$v.brokerage}%</span>
			</div>
			<div class="sotre_btn">
				<a href="/home/Charecabinet/index?id={$v.id}" class="sotre_btn1">机柜管理</a>
				<a href="/home/Seller/detail?id={$v.id}" class="sotre_btn1">查看详情</a>
			</div>	
		</li>
		{/volist}
	</ul>
	{else /}
	<div style="height: 100px;border-top:1px solid #ccc;margin-top:20px;text-align:center">
		暂无商户
	</div>
	{/notempty}
</div>

<div id='showMorehandle' ><span>已经到底了</span></div>

<script>
    (function () {
        var showMoreNChildren = function ($children, n) {
            //显示某jquery元素下的前n个隐藏的子元素
            var $hiddenChildren = $children.filter(":hidden");
            var cnt = $hiddenChildren.length;
            for ( var i = 0; i < n && i < cnt ; i++) {
                $hiddenChildren.eq(i).show();
            }
            return cnt-n;//返回还剩余的隐藏子元素的数量
        }

        //对页中现有的class=showMorehandle的元素，在之后添加显示更多条，并绑定点击行为
        $(".showMoreNChildren").each(function () {
            var pagesize = $(this).attr("pagesize") || 10;
            var $children = $(this).children();
            if ($children.length > pagesize) {
                for (var i = pagesize; i < $children.length; i++) {
                    $children.eq(i).hide();
                }

                $("<div class='showMorehandle' ><span>显示更多</span></div>").insertAfter($(this)).click(function () {
                    if (showMoreNChildren($children, pagesize) <= 0) {
                        //如果目标元素已经没有隐藏的子元素了，就隐藏“点击更多的按钮条”
                        $(this).hide();
                        $('#showMorehandle').show();
                    };
                });
            }
        });
    })();
</script>
